package win.larryzeal.spring.conf;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;
import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver;

/**
 * @author LarryZeal
 *
 */
@Configuration
public class MyConf {

	@Bean
	public SimpleMappingExceptionResolver exceptionResolver() {
		SimpleMappingExceptionResolver resolver = new SimpleMappingExceptionResolver();
		resolver.setDefaultStatusCode(HttpStatus.INTERNAL_SERVER_ERROR.value());
		resolver.setDefaultErrorView(""); // TODO: ?
		resolver.setPreventResponseCaching(true);
		resolver.setExceptionAttribute("my exception");
		// 其他设置，略
		return resolver;
	}
}
